<?php
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;
function contains($str, $content, $ignorecase=true){
    if ($ignorecase){
        $str = strtolower($str);
        $content = strtolower($content);
    }
    return strpos($content,$str) ? true : false;
}

?>
<style type="text/css">
	table{border-collapse: collapse;border: none;}
	td{ border: solid #000 1px;}
	thead th{background-color: #000000;}
	thead th a{color: red}
	tbody tr th a{color: red}
	.mytable th{ text-align: center;}
	a{color:black;}
</style>
<div>
	<select onchange="location.href='/?issue=' + this.value">
		<?
			foreach ($issue as $key => $value) {
				if($value->issue==$currentIssue){
		?>
			<option value='<?=$value->issue?>' selected><?=$value->issue?></option>
		<?
				}
				else{
		?>
			<option value='<?=$value->issue?>'><?=$value->issue?></option>
		<?
				}
			}
		?>
	</select>
</div>
<div>
	<input type="checkbox" id="chkAll" checked/>全选&nbsp;<input type="checkbox" value="" id="chk5"/>五大联赛
	<br/>
	<?
	foreach ($gameTypeList as $key => $value) {
	?>
		<input type="checkbox" value="<?=$value->gametype?>" class="chkGameType" checked/><?=$value->gametype?>
	<?
	}
	?>
</div>
<table class="mytable" id="myTable" width="100%">
	<thead>
		<tr style="background-color:#000000; text-align:center; color:white;border-right:1px solid #3E3E3E;border-bottom:1px solid #3E3E3E;line-height:20px;">
			<th align="center">序号</th>
			<!--<th align="center">编号</th>-->
			<th align="center">时间</th>
			<th align="center">赛事</th>
			<th align="center">球队&nbsp;<input type="checkbox" class="chkKing"/><span class="new_record icon_king"></span></th>
			<th align="center">比分</th>
			<th align="center">&nbsp;</th>
			<!--<th align="center">荐&nbsp;&nbsp;<a href="index.php?r=site/help" target="_blank">帮助</a></th>-->
			<!--<th align="center">亚盘<br/>平均</th>-->
			<th align="center">亚盘<br/>澳门</th>
			<!--<th align="center">亚盘<br/>赔付</th>-->
			<th align="center" title="红底：赔率低于自算；蓝字：赔率低于威廉希尔；红底并白字：赔率均低于自算和威廉希尔">欧赔<br/>平均</th>
			<!--<th align="center">欧赔<br/>比例</th>-->
			<!--<th align="center">返还<br/>率</th>-->
			<th align="center">威廉<br/>希尔</th>
			<!--<th align="center">威廉<br/>比例</th>-->
			<th align="center">澳门</th>
			<!--<th align="center">澳门<br/>比例</th>-->
			<!--<th align="center">返还<br/>率</th>-->
			<!--<th align="center">欧威<br/>比差</th>-->
			<th align="center">必发<br/>价位</th>
			<th align="center">成交<br/>比例</th>
			<th align="center">必发<br/>成交</th>
			<th align="center" title="负数表示亏损，正数表示盈利">必发<br/>盈亏</th>
			<th align="center">欧洲<br/>盈亏</th>
			<th align="center">威廉<br/>盈亏</th>
			<th align="center">澳门<br/>盈亏</th>
			<th align="center">自算<br/>盈亏</th>
			<!--<th align="center">必发<br/>指数</th>-->
			<!--<th align="center">必发<br/>赔率差</th>-->
			<th align="center">自算<br/>赔率</th>
			<th align="center">概率<br/>五大</th>
			<th align="center">概率<br/>（同）</th>
			<!--<th align="center">欧赔<br/>凯利</th>-->
			<!--<th align="center">威廉<br/>凯利</th>-->
			<!--<th align="center">必发<br/>凯利</th>-->
			<!--<th align="center">赔率<br/>差异</th>-->
			<!--<th align="center">凯利<br/>差异</th>-->
			<!--<th align="center">欧必<br/>凯利</th>-->
			<!--<th align="center">威必<br/>凯利</th>-->
			<th align="center">离散</th>
			<!--<th align="center">测试<br/>凯利</th>-->
		</tr>
	</thead>
	<tbody>
	<?
		foreach ($model as $key => $value) {
			$euroodds3=$value->euroodds3;
			$euroodds1=$value->euroodds1;
			$euroodds0=$value->euroodds0;

			$euroodds3w=$value->euroodds3w;
			$euroodds1w=$value->euroodds1w;
			$euroodds0w=$value->euroodds0w;

			$odds3m=$value->odds3m;
			$odds1m=$value->odds1m;
			$odds0m=$value->odds0m;

			//返还率
			$fanhuanlvEuro=0;
			if($euroodds3>0){
				$fanhuanlvEuro = $euroodds3*$euroodds1*$euroodds0 / ($euroodds3*$euroodds1+$euroodds1*$euroodds0+$euroodds3*$euroodds0);
			}
			
			$fanhuanlvW=0;
			if($euroodds3w>0){
				$fanhuanlvW = $euroodds3w*$euroodds1w*$euroodds0w / ($euroodds3w*$euroodds1w+$euroodds1w*$euroodds0w+$euroodds3w*$euroodds0w);
			}

			$fanhuanlvM=0;
			if($odds3m>0){
				$fanhuanlvM = $odds3m*$odds1m*$odds0m / ($odds3m*$odds1m+$odds1m*$odds0m+$odds3m*$odds0m);
			}
			

			$myodds3=$value->winprobability>0?$fanhuanlvW/$value->winprobability:0;
			$myodds1=$value->drawprobability>0?$fanhuanlvW/$value->drawprobability:0;
			$myodds0=$value->loseprobability>0?$fanhuanlvW/$value->loseprobability:0;

			//计算欧赔和威廉希尔当前的概率
			$probability3euro=0;
			$probability1euro=0;
			$probability0euro=0;
			if($euroodds3>0){
				$probability3euro=$fanhuanlvEuro/$euroodds3;
			}
			if($euroodds1>0){
				$probability1euro=$fanhuanlvEuro/$euroodds1;
			}
			if($euroodds0>0){
				$probability0euro=$fanhuanlvEuro/$euroodds0;
			}

			$probability3w=0;
			$probability1w=0;
			$probability0w=0;
			if($euroodds3w>0){
				$probability3w=$fanhuanlvW/$euroodds3w;
			}
			if($euroodds1w>0){
				$probability1w=$fanhuanlvW/$euroodds1w;
			}
			if($euroodds0w>0){
				$probability0w=$fanhuanlvW/$euroodds0w;
			}

			$probability3m=0;
			$probability1m=0;
			$probability0m=0;
			if($odds3m>0){
				$probability3m=$fanhuanlvM/$odds3m;
			}
			if($odds1m>0){
				$probability1m=$fanhuanlvM/$odds1m;
			}
			if($odds0m>0){
				$probability0m=$fanhuanlvM/$odds0m;
			}

			$euroodds3Class="";
			$euroodds1Class="";
			$euroodds0Class="";

			if($euroodds3<$euroodds3w && $euroodds3<$myodds3){
				$euroodds3Class="bred_fwhite";
			}
			else if($euroodds3<$euroodds3w){
				$euroodds3Class="white";
			}
			else if($euroodds3<$myodds3){
				$euroodds3Class="bred";
			}

			if($euroodds1<$euroodds1w && $euroodds1<$myodds1){
				$euroodds1Class="bred_fwhite";
			}
			else if($euroodds1<$euroodds1w){
				$euroodds1Class="white";
			}
			else if($euroodds1<$myodds1){
				$euroodds1Class="bred";
			}

			if($euroodds0<$euroodds0w && $euroodds0<$myodds0){
				$euroodds0Class="bred_fwhite";
			}
			else if($euroodds0<$euroodds0w){
				$euroodds0Class="white";
			}
			else if($euroodds0<$myodds0){
				$euroodds0Class="bred";
			}

			//欧赔平均凯利
			$avgoddskl3=$euroodds3*$value->winprobability*100;
			$avgoddskl1=$euroodds1*$value->drawprobability*100;
			$avgoddskl0=$euroodds0*$value->loseprobability*100;
			//$avgoddskl3=$euroodds3*$probability3euro*100;
			//$avgoddskl1=$euroodds1*$probability1euro*100;
			//$avgoddskl0=$euroodds0*$probability0euro*100;

			//威廉希尔凯利
			$woddskl3=$euroodds3w*$value->winprobability*100;
			$woddskl1=$euroodds1w*$value->drawprobability*100;
			$woddskl0=$euroodds0w*$value->loseprobability*100;
			//$woddskl3=$euroodds3w*$probability3w*100;
			//$woddskl1=$euroodds1w*$probability1w*100;
			//$woddskl0=$euroodds0w*$probability0w*100;

			
			

			//赔率差异
			$chayi3='100';
			$chayi1='100';
			$chayi0='100';
			if($fanhuanlvEuro>0&&$fanhuanlvW>0){
				if($euroodds3>0&&$euroodds3w>0){
					$chayi3=($euroodds3/$fanhuanlvEuro-$euroodds3w/$fanhuanlvW)/($euroodds3/$fanhuanlvEuro+$euroodds3w/$fanhuanlvW);
				}
				
				if($euroodds1>0&&$euroodds1w>0){
					$chayi1=($euroodds1/$fanhuanlvEuro-$euroodds1w/$fanhuanlvW)/($euroodds1/$fanhuanlvEuro+$euroodds1w/$fanhuanlvW);
				}
				
				if($euroodds0>0&&$euroodds0w>0){
					$chayi0=($euroodds0/$fanhuanlvEuro-$euroodds0w/$fanhuanlvW)/($euroodds0/$fanhuanlvEuro+$euroodds0w/$fanhuanlvW);
				}
			}

			//凯利差异
			$chayikl3=$avgoddskl3+$woddskl3==0?'100':($avgoddskl3-$woddskl3)/($avgoddskl3+$woddskl3);
			$chayikl1=$avgoddskl1+$woddskl1==0?'100':($avgoddskl1-$woddskl1)/($avgoddskl1+$woddskl1);
			$chayikl0=$avgoddskl0+$woddskl0==0?'100':($avgoddskl0-$woddskl0)/($avgoddskl0+$woddskl0);

			//是否推荐
			//第一种推荐的算法
			$jian3='';
			$jian1='';
			$jian0='';

			if($myodds3!=0&&$myodds1!=0&&$myodds0!=0){
				//第一种推荐的算法
				$jian3=$avgoddskl3<100&&$woddskl3<100?'<span class="new_record icon_star"></span>':'';
				$jian1=$avgoddskl1<100&&$woddskl1<100?'<span class="new_record icon_star"></span>':'';
				$jian0=$avgoddskl0<100&&$woddskl0<100?'<span class="new_record icon_star"></span>':'';

				//第二种推荐的算法（如果赔率差异和凯利差异相差不超过0.01）
				$jian3=abs($chayi3-$chayikl3)<0.01?'<span class="new_record icon_star"></span>'.$jian3:$jian3;
				$jian1=abs($chayi1-$chayikl1)<0.01?'<span class="new_record icon_star"></span>'.$jian1:$jian1;
				$jian0=abs($chayi0-$chayikl0)<0.01?'<span class="new_record icon_star"></span>'.$jian0:$jian0;
				
				//第三种推荐的算法（如果欧赔凯利小于等于威廉希尔凯利，并且赔率差异等于凯利差异）
				$jian3=$avgoddskl3<=$woddskl3&&(sprintf("%.2f", $chayi3)==sprintf("%.2f", $chayikl3))?'<span class="new_record icon_star"></span>'.$jian3:$jian3;
				$jian1=$avgoddskl1<=$woddskl1&&(sprintf("%.2f", $chayi1)==sprintf("%.2f", $chayikl1))?'<span class="new_record icon_star"></span>'.$jian1:$jian1;
				$jian0=$avgoddskl0<=$woddskl0&&(sprintf("%.2f", $chayi0)==sprintf("%.2f", $chayikl0))?'<span class="new_record icon_star"></span>'.$jian0:$jian0;
				
				//第四种推荐的算法（威廉希尔小于自算赔率）
				$jian3=$value->euroodds3w<=$myodds3?'<span class="new_record icon_star"></span>'.$jian3:$jian3;
				$jian1=$value->euroodds1w<=$myodds3?'<span class="new_record icon_star"></span>'.$jian1:$jian1;
				$jian0=$value->euroodds0w<=$myodds3?'<span class="new_record icon_star"></span>'.$jian0:$jian0;
				
				//第五种算法（欧赔小于威廉希尔）
				$jian3=$value->euroodds3<=$value->euroodds3w?'<span class="new_record icon_star"></span>'.$jian3:$jian3;
				$jian1=$value->euroodds1<=$value->euroodds1w?'<span class="new_record icon_star"></span>'.$jian1:$jian1;
				$jian0=$value->euroodds0<=$value->euroodds0w?'<span class="new_record icon_star"></span>'.$jian0:$jian0;				
			}

			//离散值
			$discretevalue3=$value->discretevalue3*100;
			$discretevalue1=$value->discretevalue1*100;
			$discretevalue0=$value->discretevalue0*100;

			$isKing = 0;
			//是否有皇冠
			if($discretevalue3<100&&$discretevalue1>100&&$discretevalue0>100 && $myodds3>0 && $myodds1>0 && $myodds0>0){
				$isKing = 1;
			}
			else if($discretevalue1<100&&$discretevalue3>100&&$discretevalue0>100 && $myodds3>0 && $myodds1>0 && $myodds0>0){
				$isKing = 1;
			}
			else if($discretevalue0<100&&$discretevalue3>100&&$discretevalue1>100 && $myodds3>0 && $myodds1>0 && $myodds0>0){
				$isKing = 1;
			}

			//必发数据计算
			$bfprice3=$value->bfprice3;//胜赔
			$bfprice1=$value->bfprice1;//平赔
			$bfprice0=$value->bfprice0;//负赔

			$bfexchange3 = $value->bfexchange3;//交易量胜
			$bfexchange1 = $value->bfexchange1;//交易量平
			$bfexchange0 = $value->bfexchange0;//交易量负
			$bfexchangeAll = $bfexchange3+$bfexchange1+$bfexchange0;

			$bfexchangeBili3=0;
			$bfexchangeBili1=0;
			$bfexchangeBili0=0;
			$bfexchangekl3=0;
			$bfexchangekl1=0;
			$bfexchangekl0=0;
			if($bfexchangeAll!=0){
				$bfexchangeBili3=$bfexchange3/$bfexchangeAll;//交易比例胜
				$bfexchangeBili1=$bfexchange1/$bfexchangeAll;//交易比例平
				$bfexchangeBili0=$bfexchange0/$bfexchangeAll;//交易比例负

				$bfexchangekl3=$bfprice3*$bfexchangeBili3*100;//凯利胜
				$bfexchangekl1=$bfprice1*$bfexchangeBili1*100;//凯利胜
				$bfexchangekl0=$bfprice3*$bfexchangeBili0*100;//凯利胜
			}

			$fanhuanlvbf=0;
			if($bfprice3>0&&$bfprice1>0&&$bfprice0>0){
				$fanhuanlvbf = $bfprice3*$bfprice1*$bfprice0 / ($bfprice3*$bfprice1+$bfprice1*$bfprice0+$bfprice3*$bfprice0);
			}

			//根据必发交易比例和威廉希尔返还率，自算参考赔率
			$mybfodds3=0;
			$mybfodds1=0;
			$mybfodds0=0;
			if($fanhuanlvbf>0){
				$mybfodds3=$fanhuanlvW/$bfexchangeBili3;
				$mybfodds1=$fanhuanlvW/$bfexchangeBili1;
				$mybfodds0=$fanhuanlvW/$bfexchangeBili0;
			}

			//必发指数=赔率*成交/总成交
			$bfzhishu3=0;
			$bfzhishu1=0;
			$bfzhishu0=0;
			if($bfexchangeAll>0){
				$bfexchangeAllliangjia=($bfprice3*$bfexchange3+$bfprice1*$bfexchange1+$bfprice0*$bfexchange0);
				$bfzhishu3=$bfprice3*$bfexchange3/$bfexchangeAllliangjia;
				$bfzhishu1=$bfprice1*$bfexchange1/$bfexchangeAllliangjia;
				$bfzhishu0=$bfprice0*$bfexchange0/$bfexchangeAllliangjia;
			}

			//根据欧赔平均和必发成交比例，计算参考凯利
			$avgoddsBFkl3=$euroodds3*$bfexchangeBili3*100;
			$avgoddsBFkl1=$euroodds1*$bfexchangeBili1*100;
			$avgoddsBFkl0=$euroodds0*$bfexchangeBili0*100;

			//根据威廉希尔和必发成交比例，计算参考凯利
			$avgWBFkl3=$euroodds3w*$bfexchangeBili3*100;
			$avgWBFkl1=$euroodds1w*$bfexchangeBili1*100;
			$avgWBFkl0=$euroodds0w*$bfexchangeBili0*100;

			//必发赔率差
			//（实际赔率-投注赔率）*100
			//投注赔率betodds3my=返还率/投注比例
			$betodds3my=0;
			$betodds1my=0;
			$betodds0my=0;
			$betodds3mycha=0;
			$betodds1mycha=0;
			$betodds0mycha=0;
			if($bfexchangeBili3>0 && $bfexchangeBili1>0 && $bfexchangeBili0>0){
				$betodds3my=1/$bfexchangeBili3;
				$betodds1my=1/$bfexchangeBili1;
				$betodds0my=1/$bfexchangeBili0;

				//计算赔率差
				$betodds3mycha=($bfprice3-$betodds3my)*100;
				$betodds1mycha=($bfprice1-$betodds1my)*100;
				$betodds0mycha=($bfprice0-$betodds0my)*100;
			}

			//威廉希尔比例和概率差值
			$probabilityCha3=$probability3w-$value->winprobability;
			$probabilityCha1=$probability1w-$value->drawprobability;
			$probabilityCha0=$probability0w-$value->loseprobability;

			//威廉希尔比例和必发比例差值
			//$probabilityCha3=$probability3w-$bfexchangeBili3;
			//$probabilityCha1=$probability1w-$bfexchangeBili1;
			//$probabilityCha0=$probability0w-$bfexchangeBili0;

			//根据威廉凯利和威廉差值，计算实际凯利
			//实际凯利=(1+威廉差值差值)*威廉凯利
			$realKL3=(1+$probabilityCha3)*$woddskl3;
			$realKL1=(1+$probabilityCha1)*$woddskl1;
			$realKL0=(1+$probabilityCha0)*$woddskl0;

			//计算必发盈亏
			//欧洲平均赔率*必发成交比例*必发成交额-另外2项成交额
			//$bfyingkui3=$value->euroodds3*$bfexchangeBili3*$bfexchange3-$bfexchange1-$bfexchange0;
			//$bfyingkui1=$value->euroodds1*$bfexchangeBili1*$bfexchange1-$bfexchange3-$bfexchange0;
			//$bfyingkui0=$value->euroodds0*$bfexchangeBili0*$bfexchange0-$bfexchange3-$bfexchange1;

			//总成交额-(欧洲平均赔率*必发成交比例*必发成交额)
			$bfyingkui3=($bfexchange3+$bfexchange1+$bfexchange0)-$bfprice3*$bfexchange3;
			$bfyingkui1=($bfexchange3+$bfexchange1+$bfexchange0)-$bfprice1*$bfexchange1;
			$bfyingkui0=($bfexchange3+$bfexchange1+$bfexchange0)-$bfprice0*$bfexchange0;
			//$euroexchange3=1*$probability3euro;
			//$euroexchange1=1*$probability1euro;
			//$euroexchange0=1*$probability0euro;
			//$bfyingkui3=$value->euroodds3*$probability3euro*$euroexchange3-$euroexchange1-$euroexchange0;
			//$bfyingkui1=$value->euroodds1*$probability1euro*$euroexchange1-$euroexchange3-$euroexchange0;
			//$bfyingkui0=$value->euroodds0*$probability0euro*$euroexchange0-$euroexchange3-$euroexchange1;

			//必发盈利比例
			//必发盈利比例=该项投注额/投注总额
			$bfylbi3=-100;
			$bfylbi1=-100;
			$bfylbi0=-100;
			if($bfexchange3+$bfexchange1+$bfexchange0>0){
				$bfylbi3=$bfyingkui3/($bfexchange3+$bfexchange1+$bfexchange0);
				$bfylbi1=$bfyingkui1/($bfexchange3+$bfexchange1+$bfexchange0);
				$bfylbi0=$bfyingkui0/($bfexchange3+$bfexchange1+$bfexchange0);
			}

			//平均欧洲盈亏（平均欧洲成交价*必发成交比例）
			$euroExchange3=$bfexchangeAll*$bfexchangeBili3;
			$euroExchange1=$bfexchangeAll*$bfexchangeBili1;
			$euroExchange0=$bfexchangeAll*$bfexchangeBili0;
			$euroyingkui3=$bfexchangeAll-$euroodds3*$euroExchange3;
			$euroyingkui1=$bfexchangeAll-$euroodds1*$euroExchange1;
			$euroyingkui0=$bfexchangeAll-$euroodds0*$euroExchange0;

			//威廉盈亏（威廉成交价*必发成交比例）
			$wExchange3=$bfexchangeAll*$bfexchangeBili3;
			$wExchange1=$bfexchangeAll*$bfexchangeBili1;
			$wExchange0=$bfexchangeAll*$bfexchangeBili0;
			$wyingkui3=$bfexchangeAll-$euroodds3w*$wExchange3;
			$wyingkui1=$bfexchangeAll-$euroodds1w*$wExchange1;
			$wyingkui0=$bfexchangeAll-$euroodds0w*$wExchange0;

			//自算盈亏（使用自算比例和必发成交价）
			$myExchange3=$bfexchangeAll*$value->winprobability;
			$myExchange1=$bfexchangeAll*$value->drawprobability;
			$myExchange0=$bfexchangeAll*$value->loseprobability;
			$myyingkui3=$bfexchangeAll-$bfprice3*$myExchange3;
			$myyingkui1=$bfexchangeAll-$bfprice1*$myExchange1;
			$myyingkui0=$bfexchangeAll-$bfprice0*$myExchange0;

			//澳门盈亏（上盘是让球方，根据必发成交估计上下盘的受注，计算赔付）
			$shangPF=0;
			$xiaPF=0;
			if($value->oddshomemacau>0 && $value->oddsawaymacau>0){
				$shangExchange=0;
				$xiaExchange=0;
				if($value->ratemacau>0){
					$shangExchange=$bfexchange3+$bfexchange1;
					$xiaExchange=$bfexchange0;
				}
				else if($value->ratemacau==0){
					$shangExchange=$bfexchange3;
					$xiaExchange=$bfexchange0;
				}
				else if($value->ratemacau<0){
					$shangExchange=$bfexchange3;
					$xiaExchange=$bfexchange0+$bfexchange1;
				}
				$shangPF=$value->oddshomemacau*$shangExchange;
				$xiaPF=$value->oddsawaymacau*$xiaExchange;

				$shangPF=$xiaExchange-$shangPF;
				$xiaPF=$shangExchange-$xiaPF;
			}
			/*
			//澳门比例*必发价格
			$mExchange3=$bfexchangeAll*$probability3m;
			$mExchange1=$bfexchangeAll*$probability1m;
			$mExchange0=$bfexchangeAll*$probability0m;
			$myingkui3=$bfexchangeAll-$bfprice3*$mExchange3;
			$myingkui1=$bfexchangeAll-$bfprice1*$mExchange1;
			$myingkui0=$bfexchangeAll-$bfprice0*$mExchange0;
			*/

			//澳门价格*必发成交比例
			$mExchange3=$bfexchangeAll*$bfexchangeBili3;
			$mExchange1=$bfexchangeAll*$bfexchangeBili1;
			$mExchange0=$bfexchangeAll*$bfexchangeBili0;
			$myingkui3=$bfexchangeAll-$odds3m*$mExchange3;
			$myingkui1=$bfexchangeAll-$odds1m*$mExchange1;
			$myingkui0=$bfexchangeAll-$odds0m*$mExchange0;

			//如果四个盈利都是大于0，则高亮背景颜色以示
			//如果4个盈利都大于0或都小于0，则可能打出
			$tr3BgColor="";
			$tr1BgColor="";
			$tr0BgColor="";
			if(($bfyingkui3>0&&$euroyingkui3>0&&$wyingkui3>0&&$myyingkui3>0) ||
				($bfyingkui3<0&&$euroyingkui3<0&&$wyingkui3<0&&$myyingkui3<0)){
				$tr3BgColor="#CCE6EC";
			}
			if(($bfyingkui1>0&&$euroyingkui1>0&&$wyingkui1>0&&$myyingkui1>0) ||
				($bfyingkui1<0&&$euroyingkui1<0&&$wyingkui1<0&&$myyingkui1<0)){
				$tr1BgColor="#CCE6EC";
			}
			if(($bfyingkui0>0&&$euroyingkui0>0&&$wyingkui0>0&&$myyingkui0>0) ||
				($bfyingkui0<0&&$euroyingkui0<0&&$wyingkui0<0&&$myyingkui0<0)){
				$tr0BgColor="#CCE6EC";
			}
			if($tr3BgColor=="#CCE6EC"&&$tr1BgColor=="#CCE6EC"&&$tr0BgColor=="#CCE6EC"){
				$tr3BgColor="";
				$tr1BgColor="";
				$tr0BgColor="";
			}
			//如果澳门不开盘，则不推荐
			if($value->oddshomemacau==0){
				$tr3BgColor="";
				$tr1BgColor="";
				$tr0BgColor="";
			}

			$spanTest3="";
			$spanTest1="";
			$spanTest0="";
			
			if($myodds3>0 && $myodds1>0 && $myodds0>0){
				if(floor($myodds3)==floor($euroodds3w)){
					if(floor($myodds1)==floor($euroodds1w)){
						if(floor($myodds0)==floor($euroodds0w)){
							$spanTest3="<span style='color:red'>同</span>";
							$spanTest1="<span style='color:red'>同</span>";
							$spanTest0="<span style='color:red'>同</span>";
						}
					}
				}
			}
			
	?>
	<tr style="background-color:<?=$tr3BgColor?>" gameType="<?=$value->gametype?>" isKing="<?=$isKing?>">
		<td rowspan="3" align="center"><a href="index.php?r=site/queryodds&gameid=<?=$value->gameid?>&companyid=293" target="_blank">赔率走势</a><?=$value->gameindex?></td>
		<!--<td rowspan="3"><?=$value->gameid?></td>-->
		<td rowspan="3"><?=date('Y-m-d',strtotime($value->gametime));?><br/><?=date('H:i',strtotime($value->gametime));?></td>
		<td rowspan="3"><?=$value->gametype?></td>
		<td>
		<?
			if($value->winprobability_samegametype==1){
		?>
			<span class="new_record icon_diamond"></span>
		<?
			}
		if($discretevalue3<100&&$discretevalue1>100&&$discretevalue0>100 && $myodds3>0 && $myodds1>0 && $myodds0>0){
		?>
			<span class="new_record icon_king"></span>
		<?=$value->hometeam?>
		<?
			if($chayi3>=0&&$chayikl3>=0){
		?>
		<span style="color:blue">冷</span>
		<?
			}
		}
		else{
		?>
		<?=$value->hometeam?>
		<?
		}
		?>
		<?=$spanTest3?>
		</td>
		<td><?=$value->homegoal!=-1&&$value->homegoal>$value->awaygoal?$value->homegoal.':'.$value->awaygoal:'&nbsp;'?></td>
		<td>
			<span class="<?=$value->homegoal!=-1&&$value->homegoal>$value->awaygoal?'red':'&nbsp;'?>">胜<span>
			<?
			if($value->euroodds3 < $value->euroodds3w && $bfexchange3 != 0 && $bfylbi3<0.02){
			?>
				<span class="new_record icon_crown"></span>
			<?
			}
			?>
		</td>
		<!--<td><?=$jian3?></td>-->
		<!--<td style="text-align:right"><?=sprintf("%.3f", $value->oddshome)?></td>-->
		<td style="text-align:right">
			<a href="index.php?r=site/QueryMacauAsia&gid=<?=$value->gameid?>" target="_blank">
			<?=sprintf("%.3f", $value->oddshomemacau)?>
			</a>
		</td>
		<!--<td style="text-align:right"><?=sprintf("%d", $shangPF)?></td>-->
		<td style="background-color:#C0C0C0" class="<?=$euroodds3Class?>" title="<?=sprintf("%.2f", $fanhuanlvEuro)?>"><a href="index.php?r=site/query&gid=<?=$value->gameid?>&qtype=1" target="_target" title="历史威廉希尔同赔查询"><?=sprintf("%.2f", $euroodds3)?></a></td>
		<!--<td><?=sprintf("%.2f", $probability3euro*100)?>%</td>-->
		<!--<td><?=sprintf("%.2f", $fanhuanlvEuro)?></td>-->
		<td style="background-color:#C0C0C0" title="<?=sprintf("%.2f", $fanhuanlvW)?>" class="<?=$value->euroodds3w<=$myodds3 && $myodds3!=0?"bred":""?>"><span><a href="index.php?r=site/query&gid=<?=$value->gameid?>&qtype=2" target="_target" title="历史威廉希尔同赔同类查询"><?=sprintf("%.2f", $value->euroodds3w)?><a></span></td>
		<!--<td><?=sprintf("%.2f", $probability3w*100)?>%</td>-->
		<td><a href="index.php?r=site/querymacau&gid=<?=$value->gameid?>" target="_target"><?=sprintf("%.2f", $odds3m)?></a></td>
		<!--<td><?=sprintf("%.2f", $probability3m*100)?>%</td>-->
		<!--<td><?=sprintf("%.2f", $fanhuanlvW)?></td>-->
		<!--<td><?=sprintf("%.2f", $probabilityCha3*100)?></td>-->
		<td style="text-align:right"><?=sprintf("%.2f", $bfprice3)?></td>
		<td><?=sprintf("%.2f", $bfexchangeBili3*100)?>%</td>
		<td style="text-align:right"><?=number_format(sprintf("%.0f", $bfexchange3))?></td>
		<td style="text-align:right">
			<a href="index.php?r=site/querybfyl&issue=<?=$value->issue?>&gameindex=<?=$value->gameindex?>" target="_blank">
			<?=sprintf("%d", $bfyingkui3)?>
			</a>
		</td>
		<td style="text-align:right"><?=sprintf("%d", $euroyingkui3)?></td>
		<td style="text-align:right"><?=sprintf("%d", $wyingkui3)?></td>
		<td style="text-align:right"><?=sprintf("%d", $myingkui3)?></td>
		<td style="text-align:right"><?=sprintf("%d", $myyingkui3)?></td>
		<!--<td style="text-align:right"><?=sprintf("%.2f", $bfzhishu3)?></td>-->
		<!--<td style="text-align:right">
			<?=sprintf("%.2f", $betodds3my)?><br/>
			<?=sprintf("%d", $betodds3mycha)?>
		</td>-->
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $myodds3)?></td>
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $value->winprobability*100)?>%</td>
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $value->winprobability_samegametype*100)?>%</td>
		<!--<td><?=sprintf("%.2f", $avgoddskl3)?></td>-->
		<!--<td><?=sprintf("%.2f", $woddskl3)?></td>-->
		<!--<td><?=sprintf("%.2f", $bfexchangekl3)?></td>-->
		<!--<td><?=sprintf("%.2f", $avgoddsBFkl3)?></td>-->
		<!--<td><?=sprintf("%.2f", $avgWBFkl3)?></td>-->
		<td><?=sprintf("%.2f", $discretevalue3)?></td>
		<!--<td><?=sprintf("%.2f", $realKL3)?></td>-->
	</tr>
	<tr style="background-color:<?=$tr1BgColor?>" gameType="<?=$value->gametype?>" isKing="<?=$isKing?>">
		<td>
		<?
			if($value->drawprobability_samegametype==1){
		?>
			<span class="new_record icon_diamond"></span>
		<?
			}
		if($discretevalue1<100&&$discretevalue3>100&&$discretevalue0>100 && $myodds3>0 && $myodds1>0 && $myodds0>0){
		?>
		<span class="new_record icon_king"></span>
		<?
			if($chayi1>=0&&$chayikl1>=0){
		?>
		<span style="color:blue">冷</span>
		<?
			}
		}
		else{
		?>
		
		<?
		}
		?>
		<?=$spanTest1?>
		</td>
		<td><?=$value->homegoal!=-1&&$value->homegoal==$value->awaygoal?$value->homegoal.':'.$value->awaygoal:'&nbsp;'?></td>
		<td><span class="<?=$value->homegoal!=-1&&$value->homegoal==$value->awaygoal?'red':'&nbsp;'?>">平<span>
			<?
			if($value->euroodds1 < $value->euroodds1w && $bfexchange1 != 0 && $bfylbi1<0.02){
			?>
				<span class="new_record icon_crown"></span>
			<?
			}
			?>
		</td>
		<!--<td><?=$jian1?></td>-->
		<!--<td style="text-align:right"><?=sprintf("%.3f", $value->rate)?></td>-->
		<td style="text-align:right"><?=sprintf("%.3f", $value->ratemacau)?></td>
		<!--<td>&nbsp;</td>-->
		<td style="background-color:#C0C0C0" class="<?=$euroodds1Class?>" title="<?=sprintf("%.2f", $fanhuanlvEuro)?>"><?=sprintf("%.2f", $value->euroodds1)?></td>
		<!--<td><?=sprintf("%.2f", $probability1euro*100)?>%</td>-->
		<!--<td><?=sprintf("%.2f", $fanhuanlvEuro)?></td>-->
		<td style="background-color:#C0C0C0" title="<?=sprintf("%.2f", $fanhuanlvW)?>" class="<?=$value->euroodds1w<=$myodds1 && $myodds1!=0?"bred":""?>"><span><?=sprintf("%.2f", $value->euroodds1w)?></span></td>
		<!--<td><?=sprintf("%.2f", $probability1w*100)?>%</td>-->
		<td><?=sprintf("%.2f", $odds1m)?></td>
		<!--<td><?=sprintf("%.2f", $probability1m*100)?>%</td>-->
		<!--<td><?=sprintf("%.2f", $fanhuanlvW)?></td>-->
		<!--<td><?=sprintf("%.2f", $probabilityCha1*100)?></td>-->
		<td style="text-align:right"><?=sprintf("%.2f", $bfprice1)?></td>
		<td><?=sprintf("%.2f", $bfexchangeBili1*100)?>%</td>
		<td style="text-align:right"><?=number_format(sprintf("%.0f", $bfexchange1))?></td>
		<td style="text-align:right"><?=sprintf("%d", $bfyingkui1)?></td>
		<td style="text-align:right"><?=sprintf("%d", $euroyingkui1)?></td>
		<td style="text-align:right"><?=sprintf("%d", $wyingkui1)?></td>
		<td style="text-align:right"><?=sprintf("%d", $myingkui1)?></td>
		<td style="text-align:right"><?=sprintf("%d", $myyingkui1)?></td>
		<!--<td style="text-align:right"><?=sprintf("%.2f", $bfzhishu1)?></td>-->
		<!--<td style="text-align:right">
			<?=sprintf("%.2f", $betodds1my)?><br/>
			<?=sprintf("%d", $betodds1mycha)?>
		</td>-->
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $myodds1)?></td>
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $value->drawprobability*100)?>%</td>
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $value->drawprobability_samegametype*100)?>%</td>
		<!--<td><?=sprintf("%.2f", $avgoddskl1)?></td>-->
		<!--<td><?=sprintf("%.2f", $woddskl1)?></td>-->
		<!--<td><?=sprintf("%.2f", $bfexchangekl1)?></td>-->
		<!--<td><?=sprintf("%.2f", $avgoddsBFkl1)?></td>-->
		<!--<td><?=sprintf("%.2f", $avgWBFkl1)?></td>-->
		<td><?=sprintf("%.2f", $discretevalue1)?></td>
		<!--<td><?=sprintf("%.2f", $realKL1)?></td>-->
	</tr>
	<tr style="background-color:<?=$tr0BgColor?>" gameType="<?=$value->gametype?>" isKing="<?=$isKing?>">
		<td>
		<?
			if($value->loseprobability_samegametype==1){
		?>
			<span class="new_record icon_diamond"></span>
		<?
			}
		if($discretevalue0<100&&$discretevalue1>100&&$discretevalue3>100 && $myodds3>0 && $myodds1>0 && $myodds0>0){
			?>
		<span class="new_record icon_king"></span>
		<?=$value->awayteam?>
		<?
			if($chayi0>=0&&$chayikl0>=0){
		?>
		<span style="color:blue">冷</span>
		<?
			}
		}
		else{
		?>
		<?=$value->awayteam?>
		<?
		}
		?>
		<?=$spanTest0?>
		</td>
		<td><?=$value->homegoal!=-1&&$value->homegoal<$value->awaygoal?$value->homegoal.':'.$value->awaygoal:'&nbsp;'?></td>
		<td><span class="<?=$value->homegoal!=-1&&$value->homegoal<$value->awaygoal?'red':'&nbsp;'?>">负<span>
			<?
			if($value->euroodds0 < $value->euroodds0w && $bfexchange0 != 0 && $bfylbi0<0.02){
			?>
				<span class="new_record icon_crown"></span>
			<?
			}
			?>
		</td>
		<!--<td><?=$jian0?></td>-->
		<!--<td style="text-align:right"><?=sprintf("%.3f", $value->oddsaway)?></td>-->
		<td style="text-align:right"><?=sprintf("%.3f", $value->oddsawaymacau)?></td>
		<!--<td style="text-align:right"><?=sprintf("%d", $xiaPF)?></td>-->
		<td style="background-color:#C0C0C0" class="<?=$euroodds0Class?>" title="<?=sprintf("%.2f", $fanhuanlvEuro)?>"><?=sprintf("%.2f", $value->euroodds0)?></td>
		<!--<td><?=sprintf("%.2f", $probability0euro*100)?>%</td>-->
		<!--<td><?=sprintf("%.2f", $fanhuanlvEuro)?></td>-->
		<td style="background-color:#C0C0C0" title="<?=sprintf("%.2f", $fanhuanlvW)?>" class="<?=$value->euroodds0w<=$myodds0 && $myodds0!=0?"bred":""?>"><span><?=sprintf("%.2f", $value->euroodds0w)?></span></td>
		<!--<td><?=sprintf("%.2f", $probability0w*100)?>%</td>-->
		<td><?=sprintf("%.2f", $odds0m)?></td>
		<!--<td><?=sprintf("%.2f", $probability0m*100)?>%</td>-->
		<!--<td><?=sprintf("%.2f", $fanhuanlvW)?></td>-->
		<!--<td><?=sprintf("%.2f", $probabilityCha0*100)?></td>-->
		<td style="text-align:right"><?=sprintf("%.2f", $bfprice0)?></td>
		<td><?=sprintf("%.2f", $bfexchangeBili0*100)?>%</td>
		<td style="text-align:right"><?=number_format(sprintf("%.0f", $bfexchange0))?></td>
		<td style="text-align:right"><?=sprintf("%d", $bfyingkui0)?></td>
		<td style="text-align:right"><?=sprintf("%d", $euroyingkui0)?></td>
		<td style="text-align:right"><?=sprintf("%d", $wyingkui0)?></td>
		<td style="text-align:right"><?=sprintf("%d", $myingkui0)?></td>
		<td style="text-align:right"><?=sprintf("%d", $myyingkui0)?></td>
		<!--<td style="text-align:right"><?=sprintf("%.2f", $bfzhishu0)?></td>-->
		<!--<td style="text-align:right">
			<?=sprintf("%.2f", $betodds0my)?><br/>
			<?=sprintf("%d", $betodds0mycha)?>
		</td>-->
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $myodds0)?></td>
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $value->loseprobability*100)?>%</td>
		<td style="background-color:#C0C0C0"><?=sprintf("%.2f", $value->loseprobability_samegametype*100)?>%</td>
		<!--<td><?=sprintf("%.2f", $avgoddskl0)?></td>-->
		<!--<td><?=sprintf("%.2f", $woddskl0)?></td>-->
		<!--<td><?=sprintf("%.2f", $bfexchangekl0)?></td>-->
		<!--<td><?=sprintf("%.2f", $avgoddsBFkl0)?></td>-->
		<!--<td><?=sprintf("%.2f", $avgWBFkl0)?></td>-->
		<td><?=sprintf("%.2f", $discretevalue0)?></td>
		<!--<td><?=sprintf("%.2f", $realKL0)?></td>-->
	</tr>
	<?
		}
	?>
	</tbody>
</table>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.fixedtableheader.min.js"></script>
<script type="text/javascript">
	$(function () {
        $("#myTable").fixedtableheader({ highlightrow: true, highlightclass: "stab0", headerrowsize: 1 });
    });

    $(document).ready(function(){
    	//全选
    	$("#chkAll").click(function(){
    		if($(this).attr("checked")=="checked"){
    			$("tr[gameType").show();
    			$(".chkGameType").attr("checked", true);
    		}
    		else{
    			$("tr[gameType").hide();
    			$(".chkGameType").attr("checked", false);
    		}
    	});

    	//五大联赛
    	$("#chk5").click(function(){
    		if($(this).attr("checked")=="checked"){
    			$("tr[gameType]").each(function(){
    				if($(this).attr("gameType")=="英超"||
    					$(this).attr("gameType")=="德甲"||
    					$(this).attr("gameType")=="西甲"||
    					$(this).attr("gameType")=="法甲"||
    					$(this).attr("gameType")=="意甲"){
    					$(this).show();
    					$("#chkAll").attr("checked", false);
    					$(".chkGameType").attr("checked", false);
    				}
    				else{
    					$(this).hide();
    				}
    			});
    		}
    		else{
    			$("tr").show();
    			$("#chkAll").attr("checked", true);
    			$(".chkGameType").attr("checked", true);
    		}
    	});

    	$(".chkGameType").click(function(){
    		if($(this).attr("checked")=="checked"){
    			$("tr[gameType="+$(this).attr("value")+"]").show();
    		}
    		else{
    			$("tr[gameType="+$(this).attr("value")+"]").hide();
    			$("#chkAll").attr("checked", false);
    		}
    	});

    	$(".chkKing").click(function(){
    		if($(this).attr("checked")=="checked"){
    			$("tr[isKing=0]").hide();
    			$("tr[isKing=1]").show();
    		}
    		else{
    			$("tr[gameType]").show();
    		}
    	});
    });
</script>